#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""test"""

from django.urls import resolve
from django.test import TestCase
from .controller.views import index
from .models import Blog


class HomePageTest(TestCase):

    def test_index(self):
        """
        测试index首页
        :return:
        """
        found = resolve('/')
        self.assertEqual(found.func, index)

    def test_Content(self):
        """
        测试内容
        :return:
        """
        Blog.objects.create(NUMBER=1, TITLE='王致和', SECOND_TITLE='老干妈', URL='http://baodu.com', CONTENT='真好吃')
        response = self.client.request('/blog/this_is_a_test.html')
        self.assertEqual(b'This is Blog', response.content)
